import type { ValidComponent } from "solid-js";

export type ElementType = ValidComponent;

export interface AsProp<As extends ElementType = ElementType> {
    as?: As;
}

export const IsNotNullOrUndefined = <T extends any>(data?: T): data is T => {
    return data !== undefined && data !== null;
};

export const IsNotNullOrWhiteSpaceString = (value?: string): value is string => {
    return IsNotNullOrUndefined(value) && value.trim() !== ''
}

const helper = {
    IsNotNullOrUndefined,
    IsNotNullOrWhiteSpaceString
}

export default helper
